{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/check-if-n-and-its-double-exist\n",
    "\n",
    "\n",
    "\n",
    "Runtime: 8 ms, faster than 8.93% of Go online submissions for Check If N and Its Double Exist.\n",
    "Memory Usage: 3.1 MB, less than 76.79% of Go online submissions for Check If N and Its Double Exist.\n",
    "\n",
    "\n",
    "\n",
    "```go\n",
    "package main\n",
    "\n",
    "func myContains(arr []int, x int) (bool, int) {\n",
    "\tfor i := 0; i < len(arr); i++ {\n",
    "\t\tif x == arr[i] {\n",
    "\t\t\treturn true, i\n",
    "\t\t}\n",
    "\t}\n",
    "\treturn false, -1\n",
    "}\n",
    "\n",
    "func checkIfExist(arr []int) bool {\n",
    "\tv := 0\n",
    "\td_v := 0\n",
    "\tfor i := 0; i < len(arr); i++ {\n",
    "\t\tv = arr[i]\n",
    "\t\td_v = v * 2\n",
    "\t\tcontains, index := myContains(arr, d_v)\n",
    "\t\tif contains {\n",
    "\t\t\tif index != i {\n",
    "\t\t\t\treturn true\n",
    "\t\t\t}\n",
    "\t\t}\n",
    "\t}\n",
    "\treturn false\n",
    "}\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Go",
   "language": "go",
   "name": "gophernotes"
  },
  "language_info": {
   "codemirror_mode": "",
   "file_extension": ".go",
   "mimetype": "",
   "name": "go",
   "nbconvert_exporter": "",
   "pygments_lexer": "",
   "version": "go1.15.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
